<include file="Public:header" />
<script type="text/javascript">
KindEditor.ready(function(K) {
	var editor1 = K.create('textarea[name="content"]', {
		uploadJson : "{:U('/Common/uploadEditor')}",
		allowFileManager : false,
		width : '700px',
		height : '300px'
	});
});
</script>
<style type="text/css">
.item div{display:none;}
</style>
    <h3 class="title"><em>新增导航</em><span><a href="{:U('index')}">返回列表&nbsp;&rsaquo;&nbsp;</a></span></h3>
	<div class="formbox">
    	<form name="mform" method="post" action="{:U('add')}">
		<table width="100%" border="0" cellspacing="1" cellpadding="0">
            <tr>
				<th>父级导航：</th>
				<td>
                	<select name="pid" id="pid" class="sel">
                    	<option value="0">顶级导航</option>
                        {$cateOption}
                    </select>
                    <script type="text/javascript">
					$(function(){
						$("#pid").val("{$Think.get.pid}");		
					});
					</script>
                </td>
			</tr>
            <tr>
				<th>导航类型：</th>
				<td>
                	<!--这里的值跟前台的Action一一对应-->
                	<label><input type="radio" name="column_type" class="column_type" value="About" checked="checked" /> 基本文章</label>&nbsp;
                	<label><input type="radio" name="column_type" class="column_type" value="NewsCate" /> 新闻分类</label>&nbsp;
                	<label><input type="radio" name="column_type" class="column_type" value="DiyUrl" /> 自定义链接</label>
                </td>
			</tr>
            <tr>
				<th>导航内容：</th>
				<td class="item">
                	<div class="itemAbout" style="display:block;">
                    	<select name="About" id="About" class="sel">
                            <option value="0">--请选择普通文章--</option>
                            <volist name="aboutOption" id="vo">
                            <option value="{$vo['id']}">{$vo['name']}</option>
                            </volist>
                        </select>
                    </div>
                	<div class="itemNewsCate">
                    	<select name="NewsCate" id="NewsCate" class="sel">
                            <option value="0">--请选择新闻分类--</option>
                            {$newsCateOption}
                        </select>
                    </div>
                	<div class="itemDiyUrl">
                    	<input name="DiyUrl" type="text" class="ipt" id="DiyUrl" size="50" maxlength="100" /><span class="tips">必须填写完整的url地址(如:http://www.mainwwww.com/products/)</span>
                    </div>
                    
                    <script type="text/javascript">
					$(function(){
						//导航类型要用的
						$(".column_type").click(function(){
							var thisValue = $(this).val();
							$("div[class^=item]").hide();
							$(".item"+thisValue).show();
							
							if(thisValue == 'DiyUrl'){
								$("#name").val('链接名称');
							}else{
								$("#name").val('');
							}
						});
						
						$("#About").change(function(){
							var thisValue = $(this).find("option:selected").text();
							
							$("#name").val(thisValue);	
						});
						$("#NewsCate").change(function(){
							var thisValue = $(this).find("option:selected").text();
							
							$("#name").val(thisValue);	
						});
					});
					</script>
                </td>
			</tr>
            <tr>
				<th>导航名称：</th>
				<td><input name="name" type="text" class="ipt" id="name" size="50" maxlength="50"  /><span class="tips">除了自定义链接,如果不想用默认链接,那么你可以在这里自定义导航名称</span></td>
			</tr>
            <tr>
				<th>排序权重：</th>
				<td><input name="row_sort" type="text" class="ipt" id="row_sort" size="20" maxlength="5" value="0" /><span class="tips">越小越靠前</span></td>
			</tr>
            <tr>
				<th>打开窗口目标：</th>
				<td>
                	<select name="target" id="target">
                    	<option value="_self">当前窗口(_self)</option>
                    	<option value="_blank">新窗口(_blank)</option>
                    </select>
                </td>
			</tr>
            <tr>
				<th>nofollow：</th>
				<td>
                	<label><input name="nofollow" type="radio" value="1" /> 是</label>
                	<label><input name="nofollow" type="radio" checked="checked" value="2" /> 否</label>
                </td>
			</tr>
			<tr>
				<th>状态：</th>
				<td>
                	<label><input name="status" type="radio" checked="checked" value="1" /> 显示</label>
                	<label><input name="status" type="radio" value="2" /> 不显示</label>
                </td>
			</tr>
			<tr class="btnbox">
            	<th>&nbsp;</th>
				<td>
					<input type="submit" class="btn" value="保 存">&nbsp;
					<input type="reset" class="btn" value="取 消" onClick="window.location.href='{#$fileurl#}';">
				</td>
			</tr>
		</table>
        </form>
	</div>
<include file="Public:footer" />